Left Termination of the query pattern mergesort_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

mergesort([], []).
mergesort(.(E, []), .(E, [])).
mergesort(.(E, .(F, U)), V) :- ','(split(.(E, .(F, U)), W, Y), ','(mergesort(W, X), ','(mergesort(Y, Z), merge(X, Z, V)))).
merge(X, [], X).
merge([], X, X).
merge(.(A, X), .(B, Y), .(A, Z)) :- ','(le(A, B), merge(X, .(B, Y), Z)).
merge(.(A, X), .(B, Y), .(B, Z)) :- ','(gt(A, B), merge(.(A, X), Y, Z)).
split([], [], []).
split(.(E, U), .(E, V), W) :- split(U, W, V).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), 0).
le(s(X), s(Y)) :- le(X, Y).
le(0, s(Y)).
le(0, 0).

Queries:

mergesort(g,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
mergesort_in: (b,f)
split_in: (b,f,f)
merge_in: (b,b,f)
le_in: (b,b)
gt_in: (b,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN_GA(.(E, .(F, U)), V) → U1_GA(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
MERGESORT_IN_GA(.(E, .(F, U)), V) → SPLIT_IN_GAA(.(E, .(F, U)), W, Y)
SPLIT_IN_GAA(.(E, U), .(E, V), W) → U9_GAA(E, U, V, W, split_in_gaa(U, W, V))
SPLIT_IN_GAA(.(E, U), .(E, V), W) → SPLIT_IN_GAA(U, W, V)
U1_GA(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_GA(E, F, U, V, Y, mergesort_in_ga(W, X))
U1_GA(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → MERGESORT_IN_GA(W, X)
U2_GA(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_GA(E, F, U, V, X, mergesort_in_ga(Y, Z))
U2_GA(E, F, U, V, Y, mergesort_out_ga(W, X)) → MERGESORT_IN_GA(Y, Z)
U3_GA(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_GA(E, F, U, V, merge_in_gga(X, Z, V))
U3_GA(E, F, U, V, X, mergesort_out_ga(Y, Z)) → MERGE_IN_GGA(X, Z, V)
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U5_GGA(A, X, B, Y, Z, le_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → LE_IN_GG(A, B)
LE_IN_GG(s(X), s(Y)) → U11_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U5_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → U6_GGA(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
U5_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U7_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → GT_IN_GG(A, B)
GT_IN_GG(s(X), s(Y)) → U10_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U7_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_GGA(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U7_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
U2_GA(x1, x2, x3, x4, x5, x6)  =  U2_GA(x5, x6)
U6_GGA(x1, x2, x3, x4, x5, x6)  =  U6_GGA(x1, x6)
U7_GGA(x1, x2, x3, x4, x5, x6)  =  U7_GGA(x1, x2, x3, x4, x6)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
U3_GA(x1, x2, x3, x4, x5, x6)  =  U3_GA(x5, x6)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x5)
U10_GG(x1, x2, x3)  =  U10_GG(x3)
MERGESORT_IN_GA(x1, x2)  =  MERGESORT_IN_GA(x1)
U11_GG(x1, x2, x3)  =  U11_GG(x3)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)
U9_GAA(x1, x2, x3, x4, x5)  =  U9_GAA(x1, x5)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)
U8_GGA(x1, x2, x3, x4, x5, x6)  =  U8_GGA(x3, x6)
U5_GGA(x1, x2, x3, x4, x5, x6)  =  U5_GGA(x1, x2, x3, x4, x6)
SPLIT_IN_GAA(x1, x2, x3)  =  SPLIT_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN_GA(.(E, .(F, U)), V) → U1_GA(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
MERGESORT_IN_GA(.(E, .(F, U)), V) → SPLIT_IN_GAA(.(E, .(F, U)), W, Y)
SPLIT_IN_GAA(.(E, U), .(E, V), W) → U9_GAA(E, U, V, W, split_in_gaa(U, W, V))
SPLIT_IN_GAA(.(E, U), .(E, V), W) → SPLIT_IN_GAA(U, W, V)
U1_GA(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_GA(E, F, U, V, Y, mergesort_in_ga(W, X))
U1_GA(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → MERGESORT_IN_GA(W, X)
U2_GA(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_GA(E, F, U, V, X, mergesort_in_ga(Y, Z))
U2_GA(E, F, U, V, Y, mergesort_out_ga(W, X)) → MERGESORT_IN_GA(Y, Z)
U3_GA(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_GA(E, F, U, V, merge_in_gga(X, Z, V))
U3_GA(E, F, U, V, X, mergesort_out_ga(Y, Z)) → MERGE_IN_GGA(X, Z, V)
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U5_GGA(A, X, B, Y, Z, le_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → LE_IN_GG(A, B)
LE_IN_GG(s(X), s(Y)) → U11_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U5_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → U6_GGA(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
U5_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U7_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → GT_IN_GG(A, B)
GT_IN_GG(s(X), s(Y)) → U10_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U7_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_GGA(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U7_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
U2_GA(x1, x2, x3, x4, x5, x6)  =  U2_GA(x5, x6)
U6_GGA(x1, x2, x3, x4, x5, x6)  =  U6_GGA(x1, x6)
U7_GGA(x1, x2, x3, x4, x5, x6)  =  U7_GGA(x1, x2, x3, x4, x6)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
U3_GA(x1, x2, x3, x4, x5, x6)  =  U3_GA(x5, x6)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x5)
U10_GG(x1, x2, x3)  =  U10_GG(x3)
MERGESORT_IN_GA(x1, x2)  =  MERGESORT_IN_GA(x1)
U11_GG(x1, x2, x3)  =  U11_GG(x3)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)
U9_GAA(x1, x2, x3, x4, x5)  =  U9_GAA(x1, x5)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)
U8_GGA(x1, x2, x3, x4, x5, x6)  =  U8_GGA(x3, x6)
U5_GGA(x1, x2, x3, x4, x5, x6)  =  U5_GGA(x1, x2, x3, x4, x6)
SPLIT_IN_GAA(x1, x2, x3)  =  SPLIT_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 5 SCCs with 11 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U7_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U5_GGA(A, X, B, Y, Z, le_in_gg(A, B))
U5_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
U7_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
U7_GGA(x1, x2, x3, x4, x5, x6)  =  U7_GGA(x1, x2, x3, x4, x6)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4, x5, x6)  =  U5_GGA(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U7_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U5_GGA(A, X, B, Y, Z, le_in_gg(A, B))
U5_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
U7_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U7_GGA(x1, x2, x3, x4, x5, x6)  =  U7_GGA(x1, x2, x3, x4, x6)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4, x5, x6)  =  U5_GGA(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y)) → U7_GGA(A, X, B, Y, gt_in_gg(A, B))
U7_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)
U5_GGA(A, X, B, Y, le_out_gg) → MERGE_IN_GGA(X, .(B, Y))
MERGE_IN_GGA(.(A, X), .(B, Y)) → U5_GGA(A, X, B, Y, le_in_gg(A, B))

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U10_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
le_in_gg(s(X), s(Y)) → U11_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U10_gg(gt_out_gg) → gt_out_gg
U11_gg(le_out_gg) → le_out_gg

The set Q consists of the following terms:

gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U10_gg(x0)
U11_gg(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MERGE_IN_GGA(.(A, X), .(B, Y)) → U7_GGA(A, X, B, Y, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y)) → U5_GGA(A, X, B, Y, le_in_gg(A, B))
The remaining pairs can at least be oriented weakly.

U7_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)
U5_GGA(A, X, B, Y, le_out_gg) → MERGE_IN_GGA(X, .(B, Y))
Used ordering: Polynomial interpretation [25]:

POL(.(x1, x2)) = 1 + x2   
POL(0) = 0   
POL(MERGE_IN_GGA(x1, x2)) = x1 + x2   
POL(U10_gg(x1)) = 0   
POL(U11_gg(x1)) = 0   
POL(U5_GGA(x1, x2, x3, x4, x5)) = 1 + x2 + x4   
POL(U7_GGA(x1, x2, x3, x4, x5)) = 1 + x2 + x4   
POL(gt_in_gg(x1, x2)) = 0   
POL(gt_out_gg) = 0   
POL(le_in_gg(x1, x2)) = 0   
POL(le_out_gg) = 0   
POL(s(x1)) = 0   

The following usable rules [17] were oriented: none



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

U7_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)
U5_GGA(A, X, B, Y, le_out_gg) → MERGE_IN_GGA(X, .(B, Y))

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U10_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
le_in_gg(s(X), s(Y)) → U11_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U10_gg(gt_out_gg) → gt_out_gg
U11_gg(le_out_gg) → le_out_gg

The set Q consists of the following terms:

gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U10_gg(x0)
U11_gg(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 2 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SPLIT_IN_GAA(.(E, U), .(E, V), W) → SPLIT_IN_GAA(U, W, V)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
SPLIT_IN_GAA(x1, x2, x3)  =  SPLIT_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SPLIT_IN_GAA(.(E, U), .(E, V), W) → SPLIT_IN_GAA(U, W, V)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
SPLIT_IN_GAA(x1, x2, x3)  =  SPLIT_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

SPLIT_IN_GAA(.(E, U)) → SPLIT_IN_GAA(U)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U1_GA(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_GA(E, F, U, V, Y, mergesort_in_ga(W, X))
U1_GA(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → MERGESORT_IN_GA(W, X)
MERGESORT_IN_GA(.(E, .(F, U)), V) → U1_GA(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
U2_GA(E, F, U, V, Y, mergesort_out_ga(W, X)) → MERGESORT_IN_GA(Y, Z)

The TRS R consists of the following rules:

mergesort_in_ga([], []) → mergesort_out_ga([], [])
mergesort_in_ga(.(E, []), .(E, [])) → mergesort_out_ga(.(E, []), .(E, []))
mergesort_in_ga(.(E, .(F, U)), V) → U1_ga(E, F, U, V, split_in_gaa(.(E, .(F, U)), W, Y))
split_in_gaa([], [], []) → split_out_gaa([], [], [])
split_in_gaa(.(E, U), .(E, V), W) → U9_gaa(E, U, V, W, split_in_gaa(U, W, V))
U9_gaa(E, U, V, W, split_out_gaa(U, W, V)) → split_out_gaa(.(E, U), .(E, V), W)
U1_ga(E, F, U, V, split_out_gaa(.(E, .(F, U)), W, Y)) → U2_ga(E, F, U, V, Y, mergesort_in_ga(W, X))
U2_ga(E, F, U, V, Y, mergesort_out_ga(W, X)) → U3_ga(E, F, U, V, X, mergesort_in_ga(Y, Z))
U3_ga(E, F, U, V, X, mergesort_out_ga(Y, Z)) → U4_ga(E, F, U, V, merge_in_gga(X, Z, V))
merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U5_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U11_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U5_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U6_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U7_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U10_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U7_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U8_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U8_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U6_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))
U4_ga(E, F, U, V, merge_out_gga(X, Z, V)) → mergesort_out_ga(.(E, .(F, U)), V)

The argument filtering Pi contains the following mapping:
mergesort_in_ga(x1, x2)  =  mergesort_in_ga(x1)
[]  =  []
mergesort_out_ga(x1, x2)  =  mergesort_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
split_in_gaa(x1, x2, x3)  =  split_in_gaa(x1)
split_out_gaa(x1, x2, x3)  =  split_out_gaa(x2, x3)
U9_gaa(x1, x2, x3, x4, x5)  =  U9_gaa(x1, x5)
U2_ga(x1, x2, x3, x4, x5, x6)  =  U2_ga(x5, x6)
U3_ga(x1, x2, x3, x4, x5, x6)  =  U3_ga(x5, x6)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
U5_gga(x1, x2, x3, x4, x5, x6)  =  U5_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U11_gg(x1, x2, x3)  =  U11_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U6_gga(x1, x2, x3, x4, x5, x6)  =  U6_gga(x1, x6)
U7_gga(x1, x2, x3, x4, x5, x6)  =  U7_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U10_gg(x1, x2, x3)  =  U10_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U8_gga(x1, x2, x3, x4, x5, x6)  =  U8_gga(x3, x6)
U2_GA(x1, x2, x3, x4, x5, x6)  =  U2_GA(x5, x6)
MERGESORT_IN_GA(x1, x2)  =  MERGESORT_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
QDP
                    ↳ Rewriting

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(split_in_gaa(.(E, .(F, U))))
U1_GA(split_out_gaa(W, Y)) → MERGESORT_IN_GA(W)
U2_GA(Y, mergesort_out_ga(X)) → MERGESORT_IN_GA(Y)
U1_GA(split_out_gaa(W, Y)) → U2_GA(Y, mergesort_in_ga(W))

The TRS R consists of the following rules:

mergesort_in_ga([]) → mergesort_out_ga([])
mergesort_in_ga(.(E, [])) → mergesort_out_ga(.(E, []))
mergesort_in_ga(.(E, .(F, U))) → U1_ga(split_in_gaa(.(E, .(F, U))))
split_in_gaa([]) → split_out_gaa([], [])
split_in_gaa(.(E, U)) → U9_gaa(E, split_in_gaa(U))
U9_gaa(E, split_out_gaa(W, V)) → split_out_gaa(.(E, V), W)
U1_ga(split_out_gaa(W, Y)) → U2_ga(Y, mergesort_in_ga(W))
U2_ga(Y, mergesort_out_ga(X)) → U3_ga(X, mergesort_in_ga(Y))
U3_ga(X, mergesort_out_ga(Z)) → U4_ga(merge_in_gga(X, Z))
merge_in_gga(X, []) → merge_out_gga(X)
merge_in_gga([], X) → merge_out_gga(X)
merge_in_gga(.(A, X), .(B, Y)) → U5_gga(A, X, B, Y, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U11_gg(le_out_gg) → le_out_gg
U5_gga(A, X, B, Y, le_out_gg) → U6_gga(A, merge_in_gga(X, .(B, Y)))
merge_in_gga(.(A, X), .(B, Y)) → U7_gga(A, X, B, Y, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U10_gg(gt_out_gg) → gt_out_gg
U7_gga(A, X, B, Y, gt_out_gg) → U8_gga(B, merge_in_gga(.(A, X), Y))
U8_gga(B, merge_out_gga(Z)) → merge_out_gga(.(B, Z))
U6_gga(A, merge_out_gga(Z)) → merge_out_gga(.(A, Z))
U4_ga(merge_out_gga(V)) → mergesort_out_ga(V)

The set Q consists of the following terms:

mergesort_in_ga(x0)
split_in_gaa(x0)
U9_gaa(x0, x1)
U1_ga(x0)
U2_ga(x0, x1)
U3_ga(x0, x1)
merge_in_gga(x0, x1)
le_in_gg(x0, x1)
U11_gg(x0)
U5_gga(x0, x1, x2, x3, x4)
gt_in_gg(x0, x1)
U10_gg(x0)
U7_gga(x0, x1, x2, x3, x4)
U8_gga(x0, x1)
U6_gga(x0, x1)
U4_ga(x0)

We have to consider all (P,Q,R)-chains.
By rewriting [15] the rule MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(split_in_gaa(.(E, .(F, U)))) at position [0] we obtained the following new rules:

MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(U9_gaa(E, split_in_gaa(.(F, U))))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ Rewriting
QDP
                        ↳ Rewriting

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(U9_gaa(E, split_in_gaa(.(F, U))))
U1_GA(split_out_gaa(W, Y)) → MERGESORT_IN_GA(W)
U2_GA(Y, mergesort_out_ga(X)) → MERGESORT_IN_GA(Y)
U1_GA(split_out_gaa(W, Y)) → U2_GA(Y, mergesort_in_ga(W))

The TRS R consists of the following rules:

mergesort_in_ga([]) → mergesort_out_ga([])
mergesort_in_ga(.(E, [])) → mergesort_out_ga(.(E, []))
mergesort_in_ga(.(E, .(F, U))) → U1_ga(split_in_gaa(.(E, .(F, U))))
split_in_gaa([]) → split_out_gaa([], [])
split_in_gaa(.(E, U)) → U9_gaa(E, split_in_gaa(U))
U9_gaa(E, split_out_gaa(W, V)) → split_out_gaa(.(E, V), W)
U1_ga(split_out_gaa(W, Y)) → U2_ga(Y, mergesort_in_ga(W))
U2_ga(Y, mergesort_out_ga(X)) → U3_ga(X, mergesort_in_ga(Y))
U3_ga(X, mergesort_out_ga(Z)) → U4_ga(merge_in_gga(X, Z))
merge_in_gga(X, []) → merge_out_gga(X)
merge_in_gga([], X) → merge_out_gga(X)
merge_in_gga(.(A, X), .(B, Y)) → U5_gga(A, X, B, Y, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U11_gg(le_out_gg) → le_out_gg
U5_gga(A, X, B, Y, le_out_gg) → U6_gga(A, merge_in_gga(X, .(B, Y)))
merge_in_gga(.(A, X), .(B, Y)) → U7_gga(A, X, B, Y, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U10_gg(gt_out_gg) → gt_out_gg
U7_gga(A, X, B, Y, gt_out_gg) → U8_gga(B, merge_in_gga(.(A, X), Y))
U8_gga(B, merge_out_gga(Z)) → merge_out_gga(.(B, Z))
U6_gga(A, merge_out_gga(Z)) → merge_out_gga(.(A, Z))
U4_ga(merge_out_gga(V)) → mergesort_out_ga(V)

The set Q consists of the following terms:

mergesort_in_ga(x0)
split_in_gaa(x0)
U9_gaa(x0, x1)
U1_ga(x0)
U2_ga(x0, x1)
U3_ga(x0, x1)
merge_in_gga(x0, x1)
le_in_gg(x0, x1)
U11_gg(x0)
U5_gga(x0, x1, x2, x3, x4)
gt_in_gg(x0, x1)
U10_gg(x0)
U7_gga(x0, x1, x2, x3, x4)
U8_gga(x0, x1)
U6_gga(x0, x1)
U4_ga(x0)

We have to consider all (P,Q,R)-chains.
By rewriting [15] the rule MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(U9_gaa(E, split_in_gaa(.(F, U)))) at position [0,1] we obtained the following new rules:

MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(U9_gaa(E, U9_gaa(F, split_in_gaa(U))))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ Rewriting
                      ↳ QDP
                        ↳ Rewriting
QDP
                            ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(U9_gaa(E, U9_gaa(F, split_in_gaa(U))))
U1_GA(split_out_gaa(W, Y)) → MERGESORT_IN_GA(W)
U2_GA(Y, mergesort_out_ga(X)) → MERGESORT_IN_GA(Y)
U1_GA(split_out_gaa(W, Y)) → U2_GA(Y, mergesort_in_ga(W))

The TRS R consists of the following rules:

mergesort_in_ga([]) → mergesort_out_ga([])
mergesort_in_ga(.(E, [])) → mergesort_out_ga(.(E, []))
mergesort_in_ga(.(E, .(F, U))) → U1_ga(split_in_gaa(.(E, .(F, U))))
split_in_gaa([]) → split_out_gaa([], [])
split_in_gaa(.(E, U)) → U9_gaa(E, split_in_gaa(U))
U9_gaa(E, split_out_gaa(W, V)) → split_out_gaa(.(E, V), W)
U1_ga(split_out_gaa(W, Y)) → U2_ga(Y, mergesort_in_ga(W))
U2_ga(Y, mergesort_out_ga(X)) → U3_ga(X, mergesort_in_ga(Y))
U3_ga(X, mergesort_out_ga(Z)) → U4_ga(merge_in_gga(X, Z))
merge_in_gga(X, []) → merge_out_gga(X)
merge_in_gga([], X) → merge_out_gga(X)
merge_in_gga(.(A, X), .(B, Y)) → U5_gga(A, X, B, Y, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U11_gg(le_out_gg) → le_out_gg
U5_gga(A, X, B, Y, le_out_gg) → U6_gga(A, merge_in_gga(X, .(B, Y)))
merge_in_gga(.(A, X), .(B, Y)) → U7_gga(A, X, B, Y, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U10_gg(gt_out_gg) → gt_out_gg
U7_gga(A, X, B, Y, gt_out_gg) → U8_gga(B, merge_in_gga(.(A, X), Y))
U8_gga(B, merge_out_gga(Z)) → merge_out_gga(.(B, Z))
U6_gga(A, merge_out_gga(Z)) → merge_out_gga(.(A, Z))
U4_ga(merge_out_gga(V)) → mergesort_out_ga(V)

The set Q consists of the following terms:

mergesort_in_ga(x0)
split_in_gaa(x0)
U9_gaa(x0, x1)
U1_ga(x0)
U2_ga(x0, x1)
U3_ga(x0, x1)
merge_in_gga(x0, x1)
le_in_gg(x0, x1)
U11_gg(x0)
U5_gga(x0, x1, x2, x3, x4)
gt_in_gg(x0, x1)
U10_gg(x0)
U7_gga(x0, x1, x2, x3, x4)
U8_gga(x0, x1)
U6_gga(x0, x1)
U4_ga(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MERGESORT_IN_GA(.(E, .(F, U))) → U1_GA(U9_gaa(E, U9_gaa(F, split_in_gaa(U))))
The remaining pairs can at least be oriented weakly.

U1_GA(split_out_gaa(W, Y)) → MERGESORT_IN_GA(W)
U2_GA(Y, mergesort_out_ga(X)) → MERGESORT_IN_GA(Y)
U1_GA(split_out_gaa(W, Y)) → U2_GA(Y, mergesort_in_ga(W))
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( U8_gga(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( U4_ga(x1) ) =
/0
0/
+
/00
00/
·x1

M( le_in_gg(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( [] ) =
/0
0/

M( 0 ) =
/0
0/

M( U9_gaa(x1, x2) ) =
/1
0/
+
/00
00/
·x1+
/11
10/
·x2

M( U5_gga(x1, ..., x5) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2+
/00
00/
·x3+
/00
00/
·x4+
/00
00/
·x5

M( U2_ga(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( U7_gga(x1, ..., x5) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2+
/00
00/
·x3+
/00
00/
·x4+
/00
00/
·x5

M( mergesort_out_ga(x1) ) =
/0
0/
+
/00
00/
·x1

M( U11_gg(x1) ) =
/0
0/
+
/00
00/
·x1

M( s(x1) ) =
/0
0/
+
/00
00/
·x1

M( U10_gg(x1) ) =
/0
0/
+
/00
00/
·x1

M( gt_in_gg(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( U6_gga(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( le_out_gg ) =
/0
0/

M( split_in_gaa(x1) ) =
/0
0/
+
/10
01/
·x1

M( split_out_gaa(x1, x2) ) =
/0
0/
+
/11
00/
·x1+
/11
11/
·x2

M( mergesort_in_ga(x1) ) =
/0
0/
+
/00
00/
·x1

M( U3_ga(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( .(x1, x2) ) =
/1
0/
+
/00
00/
·x1+
/11
11/
·x2

M( merge_in_gga(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( merge_out_gga(x1) ) =
/0
0/
+
/00
00/
·x1

M( U1_ga(x1) ) =
/0
0/
+
/00
00/
·x1

M( gt_out_gg ) =
/0
0/

Tuple symbols:
M( U2_GA(x1, x2) ) = 1+
[1,1]
·x1+
[0,0]
·x2

M( MERGESORT_IN_GA(x1) ) = 1+
[1,1]
·x1

M( U1_GA(x1) ) = 1+
[1,0]
·x1


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

split_in_gaa(.(E, U)) → U9_gaa(E, split_in_gaa(U))
split_in_gaa([]) → split_out_gaa([], [])
U9_gaa(E, split_out_gaa(W, V)) → split_out_gaa(.(E, V), W)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ Rewriting
                      ↳ QDP
                        ↳ Rewriting
                          ↳ QDP
                            ↳ QDPOrderProof
QDP
                                ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

U1_GA(split_out_gaa(W, Y)) → MERGESORT_IN_GA(W)
U2_GA(Y, mergesort_out_ga(X)) → MERGESORT_IN_GA(Y)
U1_GA(split_out_gaa(W, Y)) → U2_GA(Y, mergesort_in_ga(W))

The TRS R consists of the following rules:

mergesort_in_ga([]) → mergesort_out_ga([])
mergesort_in_ga(.(E, [])) → mergesort_out_ga(.(E, []))
mergesort_in_ga(.(E, .(F, U))) → U1_ga(split_in_gaa(.(E, .(F, U))))
split_in_gaa([]) → split_out_gaa([], [])
split_in_gaa(.(E, U)) → U9_gaa(E, split_in_gaa(U))
U9_gaa(E, split_out_gaa(W, V)) → split_out_gaa(.(E, V), W)
U1_ga(split_out_gaa(W, Y)) → U2_ga(Y, mergesort_in_ga(W))
U2_ga(Y, mergesort_out_ga(X)) → U3_ga(X, mergesort_in_ga(Y))
U3_ga(X, mergesort_out_ga(Z)) → U4_ga(merge_in_gga(X, Z))
merge_in_gga(X, []) → merge_out_gga(X)
merge_in_gga([], X) → merge_out_gga(X)
merge_in_gga(.(A, X), .(B, Y)) → U5_gga(A, X, B, Y, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U11_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U11_gg(le_out_gg) → le_out_gg
U5_gga(A, X, B, Y, le_out_gg) → U6_gga(A, merge_in_gga(X, .(B, Y)))
merge_in_gga(.(A, X), .(B, Y)) → U7_gga(A, X, B, Y, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U10_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U10_gg(gt_out_gg) → gt_out_gg
U7_gga(A, X, B, Y, gt_out_gg) → U8_gga(B, merge_in_gga(.(A, X), Y))
U8_gga(B, merge_out_gga(Z)) → merge_out_gga(.(B, Z))
U6_gga(A, merge_out_gga(Z)) → merge_out_gga(.(A, Z))
U4_ga(merge_out_gga(V)) → mergesort_out_ga(V)

The set Q consists of the following terms:

mergesort_in_ga(x0)
split_in_gaa(x0)
U9_gaa(x0, x1)
U1_ga(x0)
U2_ga(x0, x1)
U3_ga(x0, x1)
merge_in_gga(x0, x1)
le_in_gg(x0, x1)
U11_gg(x0)
U5_gga(x0, x1, x2, x3, x4)
gt_in_gg(x0, x1)
U10_gg(x0)
U7_gga(x0, x1, x2, x3, x4)
U8_gga(x0, x1)
U6_gga(x0, x1)
U4_ga(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 3 less nodes.